<?php
class Default_Model_DbTable_Event extends Zend_Db_Table_Abstract{
	protected $_name = "event";
	
	public function AddEvent($EName,$EImg,$DOn,$DOff,$SDesc,$LDesc,$Stt){
		$eData = array("EVENT_NAME"=>$EName,"EVENT_IMG"=>$EImg,"DATEON"=>$DOn,
				"DATEOFF"=>$DOff,"SHORT_DESCRIPTION"=>$SDesc,"LONG_DESCRIPTION"=>$LDesc,"STATUS"=>$Stt);
		$this->insert($eData);
	}
	public function UpdateEvent($EID,$EName,$EImg,$DOn,$DOff,$SDesc,$LDesc,$Stt){
		$eData = array("EVENT_NAME"=>$EName,"EVENT_IMG"=>$EImg,"DATEON"=>$DOn,
				"DATEOFF"=>$DOff,"SHORT_DESCRIPTION"=>$SDesc,"LONG_DESCRIPTION"=>$LDesc,"STATUS"=>$Stt);
		$this->update($eData,"ID = $EID");
	}
	public function DelEvent($eId){
		return $this->delete("ID = $eId");
	}
	public function GetAll(){
		return $this->fetchAll();
	}
	public function GetById($id){
		return $this->fetchRow("ID = $id");
	}
	public function changeStatus($id){
		$event = $this->fetchRow("ID = $id");
		if($event["STATUS"]==1){
			$this->update(array("STATUS"=>"0"), "ID = $id");
		}
		else{
			$this->update(array("STATUS"=>"1"), "ID = $id");
		}
	}
}